# Group Mails

**ADMIN**

| Parameter | Description | Type |
|:----------|-------------|------|
| `recipient`  | Recipient of the mail | string |
| `time` | Time of the mail | string |
| `action` | e.g Event Imported  | string |
| `subject` | Subject of the mail | string |
| `message`  | Email body | string |

## Mail Collection [/v1/mails{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
    + sort (optional, string, `time`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/filtering.html for more.

### Show all mails [GET]

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
            "meta": {
                "count": 1
            },
            "data": [
                {
                    "attributes": {
                        "action": "example",
                        "message": "example",
                        "subject": "example",
                        "recipient": "example@example.com",
                        "time": "2016-12-08T11:49:12.147941+00:00"
                    },
                    "type": "mail",
                    "id": "1",
                    "links": {
                        "self": "/v1/mails/1"
                    }
                }
            ],
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/mails"
            }
        }


## Mail Details [/v1/mails/{mail_id}]
+ Parameters
    + mail_id: 1 (integer) - ID of the mail in the form of an integer

### Get Mail Details [GET]

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
            "data": {
                "attributes": {
                    "action": "example",
                    "message": "example",
                    "subject": "example",
                    "recipient": "example@example.com",
                    "time": "2016-12-08T11:49:12.147941+00:00"
                },
                "type": "mail",
                "id": "1",
                "links": {
                    "self": "/v1/mails/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/mails/1"
            }
        }
